/*
 * EmissionsViewerView.java
 */

package emissionsviewer;

import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.TaskMonitor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.lang.Integer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import javax.swing.Timer;
import javax.swing.Icon;
import javax.swing.JCheckBox;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import misc.EmitPlot;

/**
 * The application's main frame.
 */
public class EmissionsViewerView extends FrameView {

    public EmissionsViewerView(SingleFrameApplication app) {
        super(app);

        initComponents();

        chooseRefButton.addActionListener(new OpenRefAction());
        chooseDataButton.addActionListener(new OpenDataAction()); // I know I should just reuse the one I have..
        
        // status bar initialization - message timeout, idle icon and busy animation, etc
        ResourceMap resourceMap = getResourceMap();
        int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
        messageTimer = new Timer(messageTimeout, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                statusMessageLabel.setText("");
            }
        });
        messageTimer.setRepeats(false);
        int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
        for (int i = 0; i < busyIcons.length; i++) {
            busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
        }
        busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
                statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
            }
        });
        idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
        statusAnimationLabel.setIcon(idleIcon);
        progressBar.setVisible(false);

        // connecting action tasks to status bar via TaskMonitor
        TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
        taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                String propertyName = evt.getPropertyName();
                if ("started".equals(propertyName)) {
                    if (!busyIconTimer.isRunning()) {
                        statusAnimationLabel.setIcon(busyIcons[0]);
                        busyIconIndex = 0;
                        busyIconTimer.start();
                    }
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(true);
                } else if ("done".equals(propertyName)) {
                    busyIconTimer.stop();
                    statusAnimationLabel.setIcon(idleIcon);
                    progressBar.setVisible(false);
                    progressBar.setValue(0);
                } else if ("message".equals(propertyName)) {
                    String text = (String)(evt.getNewValue());
                    statusMessageLabel.setText((text == null) ? "" : text);
                    messageTimer.restart();
                } else if ("progress".equals(propertyName)) {
                    int value = (Integer)(evt.getNewValue());
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(false);
                    progressBar.setValue(value);
                }
            }
        });
    }

    class OpenRefAction implements ActionListener {
        public void actionPerformed(ActionEvent ae) {
            //... Open a file dialog.
            int retval = refFileChooser.showOpenDialog(EmissionsViewerView.this.getFrame());
            if (retval == JFileChooser.APPROVE_OPTION) {

                EmissionsViewerApp app = (EmissionsViewerApp)EmissionsViewerApp.getInstance();

                File file = refFileChooser.getSelectedFile();
                if (file.canRead()) {
                    app.setRefFile(file);
                    EmissionsViewerView.this.refFileLabel.setText(file + " loaded");
                } else {
                    // Prompt with some sort of error alert or something
                    System.out.println("Cannot open " + file + "!");
                }
            } else if (retval == JFileChooser.CANCEL_OPTION) {
                System.out.println("Cancel button pressed.");
            } else {
                System.out.println("File access cancelled by user.");
            }
        }
    }

    class OpenDataAction implements ActionListener {
        public void actionPerformed(ActionEvent ae) {
            //... Open a file dialog.
            int retval = dataFileChooser.showOpenDialog(EmissionsViewerView.this.getFrame());
            if (retval == JFileChooser.APPROVE_OPTION) {
                File file = dataFileChooser.getSelectedFile();
                try {
                    BufferedReader bufRead = new BufferedReader(new FileReader(file));
                    EmissionsViewerApp app = (EmissionsViewerApp)EmissionsViewerApp.getInstance();
                    app.setDataFile(file);
                    EmissionsViewerView.this.dataLabel.setText(file + " loaded");
                } catch (IOException ex) {
                  System.out.println("problem accessing file"+file.getAbsolutePath());
                }
            } else {
                System.out.println("File access cancelled by user.");
            }
        }
    }

    public boolean checkAllSet() {
        boolean err = false;
        EmissionsViewerApp app = (EmissionsViewerApp)EmissionsViewerApp.getInstance();
        if (!app.getDataFile().canRead()) {
            System.err.println("Cannot read data file " + app.getDataFile());
            err = true;
        }
        if (!app.getRefFile().canRead()) {
            System.err.println("Cannot read reference file " + app.getRefFile());
            err = true;
        }

        HashMap<Integer, JCheckBox> ltcbs = new HashMap<Integer, JCheckBox>();
        ltcbs.put(1, ltcb_1);
        ltcbs.put(2, ltcb_2);
        ltcbs.put(3, ltcb_3);
        ltcbs.put(4, ltcb_4);
        ltcbs.put(5, ltcb_5);
        ltcbs.put(6, ltcb_6);
        ltcbs.put(7, ltcb_7);
        ltcbs.put(8, ltcb_8);
        ltcbs.put(9, ltcb_9);
        ltcbs.put(10, ltcb_10);

        ArrayList<Integer> lts = new ArrayList<Integer>();
        Iterator it = ltcbs.keySet().iterator();
        Integer cb_id; JCheckBox cb;
        while (it.hasNext()) {
            cb_id = (Integer)it.next();
            cb = (JCheckBox)ltcbs.get(cb_id);
            if (cb.isSelected()) {
                lts.add((Integer)cb_id);
System.out.println("id: " + cb_id + ", text: " + cb.getText());
            }
        }
        app.setLinkTypes(lts);
        if (lts.isEmpty()) {
            System.err.println("No link types were chosen");
            err = true;
        }

        return !err;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        mainPanel = new javax.swing.JPanel();
        chooseRefButton = new javax.swing.JButton();
        refFileLabel = new javax.swing.JLabel();
        chooseDataButton = new javax.swing.JButton();
        dataLabel = new javax.swing.JLabel();
        emitComboBox = new javax.swing.JComboBox();
        plotButton = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        ltcb_1 = new javax.swing.JCheckBox();
        ltcb_2 = new javax.swing.JCheckBox();
        ltcb_3 = new javax.swing.JCheckBox();
        ltcb_4 = new javax.swing.JCheckBox();
        ltcb_5 = new javax.swing.JCheckBox();
        ltcb_10 = new javax.swing.JCheckBox();
        ltcb_9 = new javax.swing.JCheckBox();
        ltcb_8 = new javax.swing.JCheckBox();
        ltcb_7 = new javax.swing.JCheckBox();
        ltcb_6 = new javax.swing.JCheckBox();
        linkTypeLabel = new javax.swing.JLabel();
        menuBar = new javax.swing.JMenuBar();
        javax.swing.JMenu fileMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
        javax.swing.JMenu helpMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();
        statusPanel = new javax.swing.JPanel();
        javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator();
        statusMessageLabel = new javax.swing.JLabel();
        statusAnimationLabel = new javax.swing.JLabel();
        progressBar = new javax.swing.JProgressBar();

        mainPanel.setName("mainPanel"); // NOI18N

        chooseRefButton.setText("Choose Refrence Library");
        chooseRefButton.setName("chooseRefButton"); // NOI18N

        refFileLabel.setText("/home/matt/gaea-matt/karman/ref.csv loaded");
        refFileLabel.setName("refFileLabel"); // NOI18N

        chooseDataButton.setText("Choose Data");
        chooseDataButton.setName("chooseDataButton"); // NOI18N

        dataLabel.setText("/home/matt/gaea-matt/karman/data.out loaded");
        dataLabel.setName("dataLabel"); // NOI18N

        emitComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21" }));
        emitComboBox.setName("emitComboBox"); // NOI18N
        emitComboBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                emitComboBoxActionPerformed(evt);
            }
        });

        plotButton.setText("Plot Emissions!");
        plotButton.setName("plotButton"); // NOI18N
        plotButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                plotButtonMouseClicked(evt);
            }
        });
        plotButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                plotButtonActionPerformed(evt);
            }
        });

        jLabel1.setText("Emission");
        jLabel1.setName("jLabel1"); // NOI18N

        jPanel1.setBackground(new java.awt.Color(202, 200, 198));
        jPanel1.setName("jPanel1"); // NOI18N

        ltcb_1.setBackground(new java.awt.Color(249, 229, 212));
        ltcb_1.setSelected(true);
        ltcb_1.setText("1");
        ltcb_1.setName("ltcb_1"); // NOI18N

        ltcb_2.setText("2");
        ltcb_2.setName("ltcb_2"); // NOI18N

        ltcb_3.setText("3");
        ltcb_3.setName("ltcb_3"); // NOI18N

        ltcb_4.setText("4");
        ltcb_4.setName("ltcb_4"); // NOI18N

        ltcb_5.setText("5");
        ltcb_5.setName("ltcb_5"); // NOI18N

        ltcb_10.setText("10");
        ltcb_10.setName("ltcb_10"); // NOI18N

        ltcb_9.setText("9");
        ltcb_9.setName("ltcb_9"); // NOI18N

        ltcb_8.setText("8");
        ltcb_8.setName("ltcb_8"); // NOI18N

        ltcb_7.setText("7");
        ltcb_7.setName("ltcb_7"); // NOI18N

        ltcb_6.setText("6");
        ltcb_6.setName("ltcb_6"); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(ltcb_1)
                    .addComponent(ltcb_2)
                    .addComponent(ltcb_3)
                    .addComponent(ltcb_4)
                    .addComponent(ltcb_5))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 102, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(ltcb_6)
                    .addComponent(ltcb_7)
                    .addComponent(ltcb_8)
                    .addComponent(ltcb_9)
                    .addComponent(ltcb_10))
                .addGap(101, 101, 101))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(ltcb_6)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(ltcb_7)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(ltcb_8)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(ltcb_9)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(ltcb_10))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(ltcb_1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(ltcb_2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(ltcb_3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(ltcb_4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(ltcb_5)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        linkTypeLabel.setText("Link types");
        linkTypeLabel.setName("linkTypeLabel"); // NOI18N

        javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
        mainPanel.setLayout(mainPanelLayout);
        mainPanelLayout.setHorizontalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(chooseRefButton)
                            .addComponent(chooseDataButton)
                            .addComponent(jLabel1)
                            .addComponent(linkTypeLabel))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(dataLabel)
                            .addComponent(refFileLabel)
                            .addComponent(emitComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(plotButton))
                .addContainerGap(31, Short.MAX_VALUE))
        );
        mainPanelLayout.setVerticalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(chooseRefButton)
                    .addComponent(refFileLabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(chooseDataButton)
                    .addComponent(dataLabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(emitComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addComponent(linkTypeLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 136, Short.MAX_VALUE)
                        .addComponent(plotButton))
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        menuBar.setName("menuBar"); // NOI18N

        fileMenu.setText("File");
        fileMenu.setName("fileMenu"); // NOI18N

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(emissionsviewer.EmissionsViewerApp.class).getContext().getActionMap(EmissionsViewerView.class, this);
        exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
        exitMenuItem.setName("exitMenuItem"); // NOI18N
        fileMenu.add(exitMenuItem);

        menuBar.add(fileMenu);

        helpMenu.setText("Help");
        helpMenu.setName("helpMenu"); // NOI18N

        aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N
        aboutMenuItem.setName("aboutMenuItem"); // NOI18N
        helpMenu.add(aboutMenuItem);

        menuBar.add(helpMenu);

        statusPanel.setName("statusPanel"); // NOI18N

        statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N

        statusMessageLabel.setName("statusMessageLabel"); // NOI18N

        statusAnimationLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        statusAnimationLabel.setName("statusAnimationLabel"); // NOI18N

        progressBar.setName("progressBar"); // NOI18N

        javax.swing.GroupLayout statusPanelLayout = new javax.swing.GroupLayout(statusPanel);
        statusPanel.setLayout(statusPanelLayout);
        statusPanelLayout.setHorizontalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(statusPanelSeparator, javax.swing.GroupLayout.DEFAULT_SIZE, 528, Short.MAX_VALUE)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(statusMessageLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 346, Short.MAX_VALUE)
                .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(statusAnimationLabel)
                .addContainerGap())
        );
        statusPanelLayout.setVerticalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addComponent(statusPanelSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(statusMessageLabel)
                    .addComponent(statusAnimationLabel)
                    .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(3, 3, 3))
        );

        setComponent(mainPanel);
        setMenuBar(menuBar);
        setStatusBar(statusPanel);
    }// </editor-fold>//GEN-END:initComponents

    private void plotButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_plotButtonMouseClicked
        if (checkAllSet()) {
            if (emitPlot == null) {
                JFrame mainFrame = EmissionsViewerApp.getApplication().getMainFrame();
                emitPlot = new EmitPlot();
                emitPlot.setLocationRelativeTo(mainFrame);
            }
            EmissionsViewerApp.getApplication().show(emitPlot);
        } else {
            System.out.println("Something isn't set!");
        }
    }//GEN-LAST:event_plotButtonMouseClicked

    // Stupid netbeans is forcing this here
    private void plotButtonActionPerformed(java.awt.event.ActionEvent evt) {

    }

    private void emitComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_emitComboBoxActionPerformed
        EmissionsViewerApp app = (EmissionsViewerApp)EmissionsViewerApp.getInstance();
        Integer I = Integer.parseInt(this.emitComboBox.getSelectedItem().toString());
        app.setEmitType(I);
    }//GEN-LAST:event_emitComboBoxActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton chooseDataButton;
    private javax.swing.JButton chooseRefButton;
    private javax.swing.JLabel dataLabel;
    private javax.swing.JComboBox emitComboBox;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JLabel linkTypeLabel;
    private javax.swing.JCheckBox ltcb_1;
    private javax.swing.JCheckBox ltcb_10;
    private javax.swing.JCheckBox ltcb_2;
    private javax.swing.JCheckBox ltcb_3;
    private javax.swing.JCheckBox ltcb_4;
    private javax.swing.JCheckBox ltcb_5;
    private javax.swing.JCheckBox ltcb_6;
    private javax.swing.JCheckBox ltcb_7;
    private javax.swing.JCheckBox ltcb_8;
    private javax.swing.JCheckBox ltcb_9;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JButton plotButton;
    private javax.swing.JProgressBar progressBar;
    private javax.swing.JLabel refFileLabel;
    private javax.swing.JLabel statusAnimationLabel;
    private javax.swing.JLabel statusMessageLabel;
    private javax.swing.JPanel statusPanel;
    // End of variables declaration//GEN-END:variables

    private final Timer messageTimer;
    private final Timer busyIconTimer;
    private final Icon idleIcon;
    private final Icon[] busyIcons = new Icon[15];
    private int busyIconIndex = 0;
    private JFrame emitPlot;
    private javax.swing.JFileChooser refFileChooser = new JFileChooser("/home/matt/gaea-matt/karman");
    private javax.swing.JFileChooser dataFileChooser = new JFileChooser("/home/matt/gaea-matt/karman");
}
